//不允许多余的非空断言。正例
interface BarType1 {
  bar: number;
}

function getFoo(): BarType1 | null {
  return null;
}
const foo: BarType1 | null = getFoo();
export const bar1: number | undefined = foo?.bar;

export function foo1(bar: number | undefined): void {
  const newBar: number = bar ?? Number.MAX_VALUE;
  console.info(`${newBar}`);
}

//ts正例
const foo: { bar: number } | null = null;
const bar = foo!.bar;

function foo(bar: number | undefined) {
  const bar: number = bar!;
}

function foo(bar?: { n: number }) {
  return bar?.n;
}

checksCounter?.textContent!.trim();

function foo(key: string | null) {
  const obj = {};
  return obj?.[key!];
}